package com.zoro.barn.business.service.system.business.teamuser.controller;

import com.zoro.barn.business.service.system.business.teamuser.entity.BarnTeamUser;
import com.zoro.barn.business.service.system.business.teamuser.service.BarnTeamUserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaoxingwu
 */
@RestController
@RequestMapping("/team-user")
public class BarnTeamUserController {

    private final BarnTeamUserService barnTeamUserService;

    public BarnTeamUserController(BarnTeamUserService barnTeamUserService) {
        this.barnTeamUserService = barnTeamUserService;
    }

    /**
     * 添加
     *
     * @param teamUser new data
     */
    @RequestMapping("/add")
    public void add(@RequestBody BarnTeamUser teamUser) {
        this.barnTeamUserService.insert(teamUser.getUserId(), teamUser.getTeamId());
    }

    /**
     * 删除
     *
     * @param teamUser data
     */
    @RequestMapping("/delete")
    public void delete(@RequestBody BarnTeamUser teamUser) {
        this.barnTeamUserService.delete(teamUser.getUserId(), teamUser.getTeamId());
    }
}
